// hyb_yl/backstageServices/pages/yuanchengkaifang/yuanchengkaifang.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    var that = this
    var bgc = wx.getStorageSync('color')
    var ifzy = options.ifzy
    if (options.zid) {
      var zid = options.zid
      var addnum = options.addnum
      var money = options.money
      that.setData({
        zid: zid,
        money: money,
        addnum: addnum
      })
    }

    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    if (options.ser_key) {
      var ser_key = options.ser_key
    } else {
      var ser_key = options.key_words
    }
    that.setData({
      ser_key: ser_key,
      tit: options.tit,
      ifzy: ifzy,
      bgc: bgc
    })
    wx.setNavigationBarTitle({
      title: options.tit
    })
    app.util.request({
      'url': 'entry/wxapp/index.detailserones',
      data: {
        ser_key: ser_key
      },
      success: function (res) {
        console.log(res)
        that.setData({
          detail: res.data
        })
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },
  mereport() {
    var openid = wx.getStorageSync('openid');
    if(openid == '')
    {
      wx.showModal({
        title: '提示',
        content:"请先登录",
        success:function(con)
        {
          if(con.confirm)
          {
            wx.navigateTo({
              url: '/hyb_yl/sgin/sgin',
            })
          }else{
            wx.switchTab({
              url: '/hyb_yl/tabBar/index/index',
            })
          }
        }
      })
    }else{
      wx.navigateTo({
        url: '/hyb_yl/mysubpages/pages/my_hzprescription/my_hzprescription',
      })
    }
    
  },
  havereport() {
    var ser_key = this.data.ser_key
    var tit = this.data.tit
    var ifzy = this.data.ifzy
    var zid = this.data.zid
    var money = this.data.money
    var addnum = this.data.addnum
    var openid = wx.getStorageSync('openid');
    if (openid == '') {
      wx.showModal({
        title: '提示',
        content: "请先登录",
        success: function (con) {
          if (con.confirm) {
            wx.navigateTo({
              url: '/hyb_yl/sgin/sgin',
            })
          }else{
            wx.switchTab({
              url: '/hyb_yl/tabBar/index/index',
            })
          }
        }
      })
    } else {
      wx.navigateTo({
        url: '/hyb_yl/backstageServices/pages/kaiyao/kaiyao?inquiry=4&key_words=' + ser_key + '&tit=' + tit + '&ifzy=' + ifzy + '&zid=' + zid + '&money=' + money + '&addnum=' + addnum,
      })
    }

  },
  nonereport() {
    var ser_key = this.data.ser_key
    var tit = this.data.tit
    var ifzy = this.data.ifzy
    var zid = this.data.zid
    var money = this.data.money
    var addnum = this.data.addnum
    var openid = wx.getStorageSync('openid');
    if (openid == '') {
      wx.showModal({
        title: '提示',
        content: "请先登录",
        success: function (con) {
          if (con.confirm) {
            wx.navigateTo({
              url: '/hyb_yl/sgin/sgin',
            })
          }else{
            wx.switchTab({
              url: '/hyb_yl/tabBar/index/index',
            })
          }
        }
      })
    } else {
      wx.navigateTo({
        url: '/hyb_yl/czhuanjiasubpages/pages/chufangmes/chufangmes?inquiry=3&key_words=' + ser_key + '&tit=' + tit + '&ifzy=' + ifzy + '&zid=' + zid + '&money=' + money + '&addnum=' + addnum,
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})